import request from "@/utils/request";

// 获取数据  /admin/subject/tag

export function getData(params) {
  return request({
    url: "/admin/subject/tag",
    params,
  });
}

// 获取学科 /admin/subject/tree
export function getDiscipline() {
  return request({
    url: "/admin/subject/tree",
  });
}

// 修改 /admin/subject/tag/

export function getModify(params) {
  return request({
    url: `/admin/subject/tag/${params}`,
  });
}

// 添加 /admin/subject/tag

export function getAddUser(data) {
  return request({
    url: "/admin/subject/tag",
    method: "POST",
    data,
  });
}
// 删除 http://122.51.249.55:7005/admin/subject/tag/

export function getDelete(params) {
  return request({
    url: `/admin/subject/tag/${params}`,
    method: "DELETE",
  });
}

// 权限 http://122.51.249.55:7005/admin/subject/tag/20

export function getUserModify(id, data) {
  return request({
    url: `/admin/subject/tag/${id}`,
    method: "PUT",
    data,
  });
}

// 所搜 /admin/subject/tag

export function getSearch(params) {
  return request({
    url: "/admin/subject/tag",
    params,
  });
}
//
export function sousuo(params) {
  return request({
    url: "/subject/tag",
    params,
  });
}

//  获取学科列表
export function getSubjectList(params){
  return request({
    url:'/admin/subject/subject',
    method:'get',
    params
  })
}

//  新增学科
export function addSubject(data){
  return request({
    url:'/admin/subject/subject',
    method:'post',
    data
  })
}

//  获取单个学科信息
export function getSubject(id){
  return request({
    url:`/admin/subject/subject/${id}`,
    method:'get'
  })
}

//  修改学科信息
export function editSubject(data){
  return request({
    url:`/admin/subject/subject/${data.id}`,
    method:'put',
    data
  })
}

//  删除学科
export function delSubject(id){
  return request({
    url:`/admin/subject/subject/${id}`,
    method:'delete'
  })
}

//  获取目录列表信息
export function getDirectoryList(params){
  return request({
    url:'/admin/subject/directory',
    method:'get',
    params
  })
}

//  获取学科列表
export function getSubList(){
  return request({
    url:'/admin/subject/tree',
    method:'get'
  })
}

//  新增目录
export function addDirectory(data){
  return request({
    url:'/admin/subject/directory',
    method:'post',
    data
  })
}

//  获取单个目录信息
export function getDirectory(id){
  return request({
    url:`/admin/subject/directory/${id}`,
    method:'get'
  })
}

//  修改目录信息
export function editDirectory(data){
  return request({
    url:`/admin/subject/directory/${data.id}`,
    method:'put',
    data
  })
}

//  删除目录
export function delDirectory(id){
  return request({
    url:`/admin/subject/directory/${id}`,
    method:'delete'
  })
}

//  上传图标
export function uploadIcon(data){
  return request({
    url:'/admin/index/upload?mode=single&type=image',
    method:'post',
    data
  })
}
//学科的数据
export const getTreeSubject = (params) => {
    return request({
        url: "/admin/subject/tree",
        method: "GET",
        params,
    });
};
